using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace ePlanSysOman
{
  public partial class frmCbe
  {
      private void grdWireNo_DoubleClick(object sender, System.EventArgs e)// ERROR: Handles clauses are not supported in C#
    {


      //FORMCLOSEEX2 = False
      //Me.Close()
      //    strEcn = FRM.viewWiresView.GetRowCellValue(FRM.viewWiresView.GetSelectedRows(0), "bacWireNo")
      //    DrwNo = FRM.viewWiresView.GetRowCellValue(FRM.viewWiresView.GetSelectedRows(0), "bacRefdes1")
      //    TypeVer = FRM.viewWiresView.GetRowCellValue(FRM.viewWiresView.GetSelectedRows(0), "bacAction")
      //    RefDes = FRM.viewWiresView.GetRowCellValue(FRM.viewWiresView.GetSelectedRows(0), "bacRefDes2")
      //    If RefDes = "" Or RefDes = "-" Then



      //        Dim DS As New DataSet
      //        Dim DC As New clsData
      //        Dim SQL As String
      //        ACTION = TypeVer

      //        wireno1 = strEcn
      //        Dim REFID As Integer
      //        If ACTION Like "*ADD*" Then
      //            ACTION = "ADD"

      //            DS = DC.getData("SELECT * FROM  PTP WHERE WIRE_END_REF <> '" & DrwNo & "' AND WIRE_NUMBER = '" & strEcn & "' AND PART_NUMBER = '" & NewHarnessPTP & "'", ni)
      //            end1 = DS.Tables(0).Rows(0)("WIRE_END_REF")
      //            Pin = DS.Tables(0).Rows(0)("WIRE_END_PIN")
      //            Term = DS.Tables(0).Rows(0)("WIRE_END_PN")
      //            length1 = DS.Tables(0).Rows(0)("WIRE_LEN_MEAS")
      //            EndPoint = DS.Tables(0).Rows(0)("WIRE_END_CD")

      //            shield = ""



      //            DS = DC.getData("SELECT REFDESID  FROM TBLREFDES WHERE REFDES = '" & end1 & "' AND RefPlanId = '" & PlanNumber & "'", ni)
      //            If DS.Tables(0).Rows.Count = 0 Then

      //                DC.ExecuteSQL("INSERT INTO TBLREFDES (REFDES,REPORTNOTE,OPN,HARNESS,REFPLANID,REFWT,REFPREVIEW) VALUES ('" & end1 & "','',2,'" & HARNESSID & "','" & PlanNumber & "','Rework wires at " & end1 & " as follows and per 16PR145','')")
      //                'Get RefDesId
      //                SQL = ("SELECT REFDESID AS REFDESID FROM TBLREFDES WHERE REFDES = '" & end1 & "' AND REFPLANID ='" & PlanNumber & "'")
      //                DS = DC.getData(SQL, ni)
      //                REFID = DS.Tables(0).Rows(0)("REFDESID")


      //            Else
      //                REFID = DS.Tables(0).Rows(0)("REFDESID")

      //            End If



      //            SQL = (String.Format("UPDATE tblBackShopWires SET bacRefDes2 = '{0}',bacPin2 ='{1}',bacTerm2 ='{2}' where (bacWireNo = '{3}' and bacPlId = '{4}' and bacAction ='{5}')", end1, Pin, Term, wireno1, PlanNumber, ACTION))
      //            DC.ExecuteSQL(SQL)
      //            SQL = "INSERT INTO tblWires "
      //            SQL = SQL & "(WIREACTid,WIRENO,wREFDESid,PIN,LENGTH,TERM,SWIRENO,SREFDES,SHIELD,WIRESPLID,ENDPOINT) VALUES "
      //            SQL = SQL & "('" & ACTION & "','" & strEcn & "'," & REFID & ",'" & Pin & "','" & length1 & "','" & Term & "','" & strEcn & "','" & end1 & "','','" & PlanNumber & "','" & EndPoint & "')"
      //            DC.ExecuteSQL(SQL)
      //            SQL = "INSERT INTO tblWiresAdd "
      //            SQL = SQL & "(WIREACTid,WIRENO,wREFDESid,PIN,LENGTH,TERM,SWIRENO,SREFDES,SHIELD,WIRESPLID,ENDPOINT) VALUES "
      //            SQL = SQL & "('" & ACTION & "','" & strEcn & "'," & REFID & ",'" & Pin & "','" & length1 & "','" & Term & "','" & strEcn & "','" & end1 & "','','" & PlanNumber & "','" & EndPoint & "')"
      //            DC.ExecuteSQL(SQL)

      //        ElseIf ACTION Like "*REM*" Then
      //            DS = DC.getData("SELECT * FROM  PTP WHERE WIRE_END_REF <> '" & DrwNo & "' AND WIRE_NUMBER = '" & strEcn & "' AND PART_NUMBER = '" & OldHarnessPTP & "'", ni)
      //            end1 = DS.Tables(0).Rows(0)("WIRE_END_REF")
      //            Pin = DS.Tables(0).Rows(0)("WIRE_END_PIN")
      //            Term = DS.Tables(0).Rows(0)("WIRE_END_PN")
      //            length1 = DS.Tables(0).Rows(0)("WIRE_LEN_MEAS")
      //            EndPoint = DS.Tables(0).Rows(0)("WIRE_END_CD")
      //            shield = ""


      //            ACTION = "REMOVE"
      //            DS = DC.getData("SELECT REFDESID  FROM TBLREFDES WHERE REFDES = '" & end1 & "' AND RefPlanId = '" & PlanNumber & "'", ni)
      //            If DS.Tables(0).Rows.Count = 0 Then

      //                DC.ExecuteSQL("INSERT INTO TBLREFDES (REFDES,REPORTNOTE,OPN,HARNESS,REFPLANID,REFWT,REFPREVIEW) VALUES ('" & end1 & "','',2,'" & HARNESSID & "','" & PlanNumber & "','Rework wires at " & end1 & " as follows and per 16PR145','')")
      //                'Get RefDesId
      //                SQL = ("SELECT REFDESID AS REFDESID FROM TBLREFDES WHERE REFDES = '" & end1 & "' AND REFPLANID ='" & PlanNumber & "'")
      //                DS = DC.getData(SQL, ni)
      //                REFID = DS.Tables(0).Rows(0)("REFDESID")


      //            Else
      //                REFID = DS.Tables(0).Rows(0)("REFDESID")

      //            End If

      //            SQL = (String.Format("UPDATE tblBackShopWires SET bacRefDes2 = '{0}',bacPin2 ='{1}',bacTerm2 ='{2}' where (bacWireNo = '{3}' and bacPlId = '{4}' and bacAction ='{5}')", end1, Pin, Term, wireno1, PlanNumber, ACTION))
      //            DC.ExecuteSQL(SQL)
      //            SQL = "INSERT INTO tblWires "
      //            SQL = SQL & "(WIREACTid,WIRENO,wREFDESid,PIN,LENGTH,TERM,SWIRENO,SREFDES,SHIELD,WIRESPLID,ENDPOINT) VALUES "
      //            SQL = SQL & "('" & ACTION & "','" & strEcn & "'," & REFID & ",'" & Pin & "','" & length1 & "','" & Term & "','" & strEcn & "','" & end1 & "','','" & PlanNumber & "','" & EndPoint & "')"
      //            DC.ExecuteSQL(SQL)
      //            SQL = "INSERT INTO tblWiresREMOVE "
      //            SQL = SQL & "(WIREACTid,WIRENO,wREFDESid,PIN,LENGTH,TERM,SWIRENO,SREFDES,SHIELD,WIRESPLID,ENDPOINT) VALUES "
      //            SQL = SQL & "('" & ACTION & "','" & strEcn & "'," & REFID & ",'" & Pin & "','" & length1 & "','" & Term & "','" & strEcn & "','" & end1 & "','','" & PlanNumber & "','" & EndPoint & "')"
      //            DC.ExecuteSQL(SQL)

      //        End If


      //        FRM.daWiresView.Fill(FRM.dsElectrical, "tblBackShopWires")


      //        'viewBackShopWires.SetRowCellValue(viewBackShopWires.FocusedRowHandle, "bacRefDes2", "Filled")

      //    End If
    }

    private void  // ERROR: Handles clauses are not supported in C#
frmWireNo_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
    {
      //FormCloseex = FORMCLOSEEX2

    }

    private void  // ERROR: Handles clauses are not supported in C#
grdWireNo_Load(object sender, System.EventArgs e)
    {
    }

    private void  // ERROR: Handles clauses are not supported in C#
viewWireNo_GroupLevelStyle(object sender, DevExpress.XtraGrid.Views.Grid.GroupLevelStyleEventArgs e)
    {

      //  e.LevelAppearance.BackColor = ColorFromID(e.Level)
      if ((e.Level == 1)) {
        e.LevelAppearance.BackColor = Color.White;
        e.LevelAppearance.ForeColor = Color.DarkOrchid;

      }
      if ((e.Level == 0)) {
        e.LevelAppearance.BackColor = Color.Lavender;
        e.LevelAppearance.BackColor2 = Color.YellowGreen;
        e.LevelAppearance.GradientMode = LinearGradientMode.Horizontal;//JMR took our Drawing2d.etc
        e.LevelAppearance.ForeColor = Color.Black;


      }


    }
      public frmCbe()
    {
        InitializeComponent();
    }
  }
}

